<script>
$(document).ready(function(){
	{params}
	
	var c = {
		info:{},
		init:function(){
			this.onshow(params);
		},
		onshow:function(d){
			if(this.info.id == d.id)return;
			params = d;
			this.info = d;
			$('#name_{rand}').html(d.name);
			$('#list_{rand}').html('<div align="center" style="line-height:100px">'+js.show.ling(20)+'</div>');
			
			js.ajax.get({
				url:'api/company/deptuser',
				cnum:reim.cnum,
				data:{
					id:d.id
				}
			},function(ret){
				c.showloaddata(ret.data);
			});
		},
		showloaddata:function(da){
			this.showuser(da.userarr);
		},
		showuser:function(da){
			var s = '',d,hei=30;
			this.userarr = da;
			s='<div align="center" style="line-height:50px" class="fontsize12 hui">-底下无人员-</div>';
			if(da){
				s='';
				for(var i=0;i<da.length;i++){
					d = da[i];
					s+='<div clickevt="uxiang,'+i+'" class="chatlist"><table><tr>';
					s+='<td ><div style="height:'+hei+'px;overflow:hidden;padding-right:8px"><img src="'+getface(d.face)+'" style="height:'+hei+'px;width:'+hei+'px"></div></td>';
					s+='<td><div class="name">'+d.name+'</div><div class="cont">'+d.deptname+'';
					if(d.ranking)s+='('+d.ranking+')';
					s+='</div></td>';
					
					s+='</tr></table></div>';
				}
			}
			s += '<div align="center" style="margin-top:10px;color:#cccccc">'+da.length+'人</div>';
			s+='<div class="blank10"></div>';
			$('#list_{rand}').html(s);

			js.initbtn(this,'shomain_{rand}');
		},
		uxiang:function(o1, i){
			var d = this.userarr[i];
			var s = '';
			s = '<div align="center" style="margin:10px"><div style="max-width:400px">';
			s+=' 	<div><img src="'+getface(d.face)+'" onclick="js.viewimg(this)" style="border-radius:50%;height:80px;width:80px"></div>';
			s+=' 	<div>'+d.name+'</div>';
			s+=' 	<div style="color:#aaaaaa;margin-top:10px" class="fontsize14">部门：'+d.deptname+'</div>';
			if(d.ranking)s+=' 	<div style="color:#aaaaaa;margin-top:5px" class="fontsize14">职位：'+d.ranking+'</div>';
			s+= '</div></div>';
			js.modal.main({
				html:s,
				width:300,
				height:200,
				action:'userinfo',
				title:'人员信息',
				btn:[{text:'<i class="icon-comments-alt"></i> 发消息'}]
			});
			$('#userinfo_btn0').click(function(){
				c.sendchat(false, i);
			});
		},
		sendchat:function(o1,i){
			js.modal.close('userinfo');
			var d = this.userarr[i];
			var ds= {type:'0',id:d.id,name:d.name,face:d.face,deptname:d.deptname,ranking:d.ranking,cnum:reim.cnum,bh:'chat0_'+d.id+''};
			reim.addtabs(ds.bh, 'reim/chatwe', ds);
		},
		close:function(){
			reim.closetabsnow();
		}
	}
	
	js.initbtn(c);
	reim.tdept = c;
});
</script>
<div id="shomain_{rand}">
	<div style="line-height:40px;height:40px;overflow:hidden;display:flex" align="center">
		<div clickevt="close" style="width:30px"><i class="icon-angle-left"></i></div>
		<div style="flex:1" id="name_{rand}"></div>
		<div style="width:30px"></div>
	</div>

	<div id="list_{rand}" resizes="40" class="rock-border-t" style="height:120px;overflow:auto;position:relative;"></div>

</div>